<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>家庭药品管理 - 设置</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/common.css">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#16a34a',
                        secondary: '#4ade80',
                        dark: '#1e293b',
                        light: '#f8fafc'
                    }
                }
            }
        }
    </script>
    <style>
        /* iPhone 15 模拟外壳样式 */
        .iphone-frame {
            width: 390px;
            height: 844px;
            border-radius: 44px;
            background-color: #000;
            margin: 20px auto;
            position: relative;
            overflow: hidden;
            box-shadow: 0 0 0 10px #111, 0 0 0 11px #333, 0 20px 50px rgba(0, 0, 0, 0.3);
        }
        
        /* 顶部刘海区域 */
        .iphone-notch {
            position: absolute;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 200px;
            height: 30px;
            background-color: #000;
            border-radius: 0 0 20px 20px;
            z-index: 10;
        }
        
        /* 底部安全区域 */
        .iphone-home-indicator {
            position: absolute;
            bottom: 8px;
            left: 50%;
            transform: translateX(-50%);
            width: 120px;
            height: 5px;
            background-color: rgba(255, 255, 255, 0.6);
            border-radius: 5px;
            z-index: 10;
        }
        
        /* 顶部状态栏 */
        .iphone-status-bar {
            height: 50px;
            background-color: #fff;
            padding-top: 15px;
            padding-left: 20px;
            padding-right: 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 14px;
            font-weight: 600;
        }
        
        /* 页面标题栏 */
        .page-header {
            height: 44px;
            background-color: #fff;
            display: flex;
            align-items: center;
            padding: 0 16px;
            border-bottom: 1px solid #e5e7eb;
        }
        
        .back-button {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            color: #1e293b;
        }
        
        .header-title {
            font-size: 18px;
            font-weight: 600;
            color: #1e293b;
            flex: 1;
            text-align: center;
            margin-right: 40px; /* 为了标题居中对齐 */
        }
        
        /* 内容区域 */
        .iphone-content {
            height: calc(100% - 50px - 44px - 20px);
            background-color: #f8fafc;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
        
        /* 设置项样式 */
        .settings-section {
            margin-bottom: 20px;
            background-color: white;
        }
        
        .settings-section-title {
            font-size: 14px;
            font-weight: 600;
            color: #64748b;
            padding: 16px 16px 8px;
        }
        
        .setting-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px;
            border-bottom: 1px solid #f1f5f9;
        }
        
        .setting-item:last-child {
            border-bottom: none;
        }
        
        .setting-left {
            display: flex;
            align-items: center;
        }
        
        .setting-icon {
            width: 24px;
            height: 24px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 12px;
            font-size: 16px;
        }
        
        .setting-title {
            font-size: 15px;
            color: #1e293b;
        }
        
        .setting-value {
            font-size: 14px;
            color: #64748b;
        }
        
        /* 开关样式 */
        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 50px;
            height: 26px;
        }
        
        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }
        
        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #e5e7eb;
            transition: .4s;
            border-radius: 26px;
        }
        
        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 18px;
            width: 18px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }
        
        input:checked + .toggle-slider {
            background-color: #16a34a;
        }
        
        input:checked + .toggle-slider:before {
            transform: translateX(24px);
        }
        
        /* 版本信息 */
        .version-info {
            text-align: center;
            font-size: 12px;
            color: #9ca3af;
            margin: 24px 0 16px;
        }
        
        /* 清除缓存按钮 */
        .clear-cache-button {
            width: calc(100% - 32px);
            margin: 16px;
            padding: 12px;
            background-color: #fee2e2;
            color: #ef4444;
            border: none;
            border-radius: 12px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <div class="iphone-frame">
        <!-- 顶部刘海 -->
        <div class="iphone-notch"></div>
        
        <!-- 状态栏 -->
        <div class="iphone-status-bar">
            <div>9:41</div>
            <div class="flex space-x-2">
                <i class="fa fa-signal"></i>
                <i class="fa fa-wifi"></i>
                <i class="fa fa-battery-full"></i>
            </div>
        </div>
        
        <!-- 页面标题栏 -->
        <div class="page-header">
            <button class="back-button" id="backButton">
                <i class="fa fa-chevron-left"></i>
            </button>
            <div class="header-title">设置</div>
        </div>
        
        <!-- 内容区域 -->
        <div class="iphone-content">
            <!-- 提醒设置 -->
            <div class="settings-section-title">提醒设置</div>
            <div class="settings-section">
                <div class="setting-item">
                    <div class="setting-left">
                        <div class="setting-icon" style="background-color: #f0fdf4; color: #16a34a;">
                            <i class="fa fa-bell"></i>
                        </div>
                        <div class="setting-title">启用提醒通知</div>
                    </div>
                    <label class="toggle-switch">
                        <input type="checkbox" id="notificationsToggle" checked>
                        <span class="toggle-slider"></span>
                    </label>
                </div>
                <div class="setting-item">
                    <div class="setting-left">
                        <div class="setting-icon" style="background-color: #f0fdf4; color: #16a34a;">
                            <i class="fa fa-volume-up"></i>
                        </div>
                        <div class="setting-title">声音提醒</div>
                    </div>
                    <label class="toggle-switch">
                        <input type="checkbox" id="soundToggle" checked>
                        <span class="toggle-slider"></span>
                    </label>
                </div>
                <div class="setting-item">
                    <div class="setting-left">
                        <div class="setting-icon" style="background-color: #f0fdf4; color: #16a34a;">
                            <i class="fa fa-bolt"></i>
                        </div>
                        <div class="setting-title">振动提醒</div>
                    </div>
                    <label class="toggle-switch">
                        <input type="checkbox" id="vibrationToggle" checked>
                        <span class="toggle-slider"></span>
                    </label>
                </div>
                <div class="setting-item">
                    <div class="setting-left">
                        <div class="setting-icon" style="background-color: #f0fdf4; color: #16a34a;">
                            <i class="fa fa-clock-o"></i>
                        </div>
                        <div class="setting-title">提前提醒时间</div>
                    </div>
                    <div class="setting-value">10分钟</div>
                </div>
            </div>
            
            <!-- 隐私设置 -->
            <div class="settings-section-title">隐私设置</div>
            <div class="settings-section">
                <div class="setting-item">
                    <div class="setting-left">
                        <div class="setting-icon" style="background-color: #f0fdf4; color: #16a34a;">
                            <i class="fa fa-lock"></i>
                        </div>
                        <div class="setting-title">生物识别解锁</div>
                    </div>
                    <label class="toggle-switch">
                        <input type="checkbox" id="biometricToggle" checked>
                        <span class="toggle-slider"></span>
                    </label>
                </div>
                <div class="setting-item">
                    <div class="setting-left">
                        <div class="setting-icon" style="background-color: #f0fdf4; color: #16a34a;">
                            <i class="fa fa-history"></i>
                        </div>
                        <div class="setting-title">用药记录</div>
                    </div>
                    <div class="setting-value">已开启</div>
                </div>
            </div>
            
            <!-- 显示设置 -->
            <div class="settings-section-title">显示设置</div>
            <div class="settings-section">
                <div class="setting-item">
                    <div class="setting-left">
                        <div class="setting-icon" style="background-color: #f0fdf4; color: #16a34a;">
                            <i class="fa fa-moon-o"></i>
                        </div>
                        <div class="setting-title">深色模式</div>
                    </div>
                    <label class="toggle-switch">
                        <input type="checkbox" id="darkModeToggle">
                        <span class="toggle-slider"></span>
                    </label>
                </div>
                <div class="setting-item">
                    <div class="setting-left">
                        <div class="setting-icon" style="background-color: #f0fdf4; color: #16a34a;">
                            <i class="fa fa-font"></i>
                        </div>
                        <div class="setting-title">字体大小</div>
                    </div>
                    <div class="setting-value">标准</div>
                </div>
            </div>
            
            <!-- 清除缓存 -->
            <button class="clear-cache-button" id="clearCacheButton">清除缓存</button>
            
            <!-- 版本信息 -->
            <div class="version-info">版本 1.0.0 (20230925)</div>
        </div>
        
        <!-- 底部安全指示器 -->
        <div class="iphone-home-indicator"></div>
    </div>

    <script>
        // 返回按钮点击事件
        document.getElementById('backButton').addEventListener('click', function() {
            console.log('用户点击了返回按钮');
            window.history.back();
        });
        
        // 开关切换事件
        document.querySelectorAll('input[type="checkbox"]').forEach(toggle => {
            toggle.addEventListener('change', function() {
                const settingName = this.closest('.setting-item').querySelector('.setting-title').textContent;
                console.log(settingName + ' 已' + (this.checked ? '开启' : '关闭'));
            });
        });
        
        // 可点击的设置项事件
        document.querySelectorAll('.setting-item:not(:has(.toggle-switch))').forEach(item => {
            item.addEventListener('click', function() {
                const settingName = this.querySelector('.setting-title').textContent;
                console.log('用户点击了设置项:', settingName);
                alert(`打开${settingName}设置`);
            });
        });
        
        // 清除缓存按钮点击事件
        document.getElementById('clearCacheButton').addEventListener('click', function() {
            if (confirm('确定要清除应用缓存吗？')) {
                console.log('用户确认清除缓存');
                // 模拟清除缓存操作
                setTimeout(() => {
                    alert('缓存已清除');
                }, 500);
            }
        });
    </script>
</body>
</html>